<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ taglib prefix="catalog" tagdir="/WEB-INF/tags/catalog"%>
<%@ taglib prefix="product" tagdir="/WEB-INF/tags/product"%>
<%@ taglib prefix="customer" tagdir="/WEB-INF/tags/customer"%>
<title><fmt:message key="consultList.title"/>-${empty	product.title?product.productName:product.title}</title>
<meta name="keywords" content="${not empty product.metaKeyword?product.metaKeyword:product.keywords}" />
<meta name="description" content="${not empty product.metaDescription?product.metaDescription:product.productDescription.shortDescription}" />

<div class="position"><fmt:message key="your.position"/><a href="${ctxPath}/index.html"><fmt:message key="menu.main"/></a> &gt; <product:productName product="${product}" /> &gt;<fmt:message key="consultList.consultMsg"/>
<div class="line10"></div>
<div class="clearfix">
	<div class="main_left">
		<%---------------------------------start:商品信息 -------------------------%>
		<%@ include file="include/shortProductInfo.jspf"%>
		<%---------------------------------end:  商品信息 -------------------------%>
	</div>
	<div class="main_right_content">
		<div class="wrap_04">
			<div class="tab_04">
				<ul class="content clearfix">
					<c:if test="${not empty consultSearchCriteria.keywords}">
						<li><a href="#" class="curr"><fmt:message key="consultList.searchResult"/>(${sc.totalCount})</a></li>
					</c:if>
					<li><a href="<customer:consultUrl product="${product}"/>" <c:if test="${empty consultSearchCriteria.keywords}">class="curr"</c:if> ><fmt:message key="consultList.all"/>(${count})</a></li>
				</ul>
			</div>
			<div class="content">
				<div class="refer_search">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td width="27%"><b><fmt:message key="consult.search.tip1"/>：</b><br />
								<form action="<customer:consultUrl product="${product}"/>">
									<input name="keywords" type="text" class="inputtxt" style="width:160px" value="${consultSearchCriteria.keywords}" /><br />
									<input name="" type="submit" class="go" value="" />
								</form>	
								</td>
							<td width="46%">
								<p><fmt:message key="consult.search.tip2"/></p>
							</td>
							<td width="27%" align="center"><a href="#addConsultForm" class="add"><b><fmt:message key="consult.addConsult"/></b></a></td>
						</tr>
					</table>
				</div>
				<form id="consultListForm">
					<c:forEach items="${consultList}" var="consult">
						<div class="refer" >
							<dl class="ask clearfix">
								<dt><fmt:message key="consult.message"/>：</dt>
								<dd>${consult.message}</dd>
								<dd class="writer">
									${consult.consultUserArea} ${consult.consultUserName}<br/> 
									<span class="time"><fmt:formatDate value="${consult.createTime}" pattern="yyyy-MM-dd HH:mm" /></span>
								</dd>
							</dl>
							<customer:getConsultReplys consultId="${consult.consultId}" returnReplyListName="replyList"/>
							<c:forEach items="${replyList}" var="reply" varStatus="replyStatus">
								<dl class="answer clearfix">
									<dt><fmt:message key="consult.reply"/>：</dt><dd>${reply.message}</dd>
									<dd class="time"><fmt:formatDate value="${reply.createTime}" pattern="yyyy-MM-dd HH:mm" /></dd>
								</dl>
							</c:forEach>
							<c:if test="${empty replyList}">
								<dl class="answer clearfix">
									<dt><fmt:message key="consult.reply.notYet"/>。</dt>
								</dl>
							</c:if>
							
							<c:if test="${not empty replyList}">
								<div class="do">
									<fmt:message key="consult.consultIsSatisfied"/>：
									<a class="satisfied" id="satisfiedFul_${consult.consultId}" href="javascript:void(0)"><fmt:message key="consult.satisfied"/></a>(<span id="span_satisfiedCount_${consult.consultId}">${consult.satisfiedCount}</span>)
									<a class="dissatisfied" id="unsatisfiedFul_${consult.consultId}" href="javascript:void(0)"><fmt:message key="consult.unsatisfied"/></a>(<span id="span_unsatisfiedCount_${consult.consultId}">${consult.unsatisfiedCount}</span>)
								</div>
							</c:if>
						</div>
					</c:forEach>
					
					<c:if test="${empty consultList}">
						<div class="others_info">
							<fmt:message key="consultList.noConsult"/>,
							<a href="#addConsultForm"><fmt:message key="consultList.addConsultRightNow"/></a>
						</div>
					</c:if>
					
					<%--------保存查询条件 -------%>
					<%@include file="include/consultSearchCriteriaStorage.jspf"%>
					<div class="page_bottom clearfix">
						<paging:linkPagingBottom/>
					</div>
				</form>
			</div>
		
			<%@ include file="consultForm.jsp"%>		
		</div>
	</div>		
</div>	

		
<c:set var="probizJs_validation" value="true" scope="request"/>	
<c:set var="probizJs_loginDlg" value="true" scope="request"/>
<c:set var="plugin_highlight" value="true" scope="request"/>
<c:set var="probizJs_shoppingcart" value="true" scope="request"/>
<c:set var="probizJs_consult" value="true" scope="request"/>
<script type="text/javascript">
$j(document).ready(function () {
	<%--start:获取权限设定 --%>
	consultRight = '${appConfig.customerConsultRight}';	
	consultProductId = ${product.productId};	
	<%--end:  获取权限设定 --%>	
	<c:forEach items="${consultList}" var="consult">
		$j('#satisfiedFul_'+${consult.consultId}).bind('click',{"consultId":${consult.consultId},"chosen":1},consultVote);
		$j('#unsatisfiedFul_'+${consult.consultId}).bind('click',{"consultId":${consult.consultId},"chosen":0},consultVote);
	</c:forEach>
	<%--start:登录检查 --%>	
	$j('#customerName,#message').bind('click',consultRightCheck);
	<%--end:  登录检查 --%>	
	
	<c:if test="${sc.totalCount != 0}">	
		//stat:高亮搜索结果
		if("${consultSearchCriteria.keywords}".trim() != ""){
			 var searchValues = "${consultSearchCriteria.keywords}".trim().replace(/\s+/,"|").split("|");
			 highlight($('consultListForm'),searchValues); 
		} 
		//end:高亮搜索结果
	</c:if>	 
});
</script>